#include<stdio.h>

void main (){

    for (int i = 10000; i <= 99999; i++)
    {
        int x1,x2,x3,x4,x5;
        int temp=i;

        x5=temp%10;
        temp=temp/10;

        x4=temp%10;
        temp= temp/10;

        x3=temp%10;
        temp= temp/10;

        x2=temp%10;
        temp= temp/10;

        x1=temp%10;
        temp= temp/10;

        int nn=x1*x1*x1*x1*x1+x2*x2*x2*x2*x2+x3*x3*x3*x3*x3+x4*x4*x4*x4*x4+x5*x5*x5*x5*x5;
        if (i==nn)
        {
           printf("%d %d %d %d %d\n",x1,x2,x3,x4,x5);
        }
        
       
        

    }
}